<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>
<body>
<!--组件，类似于自定义标签 复用-->
<div id="app">
</div>
<div id="app2">
<!--    外层遍历vm中的数据，得到item，根据vue组件中的绑定属性props的object，用bind进行绑定，传递给组件-->
    <squid v-for=" item in items" v-bind:object="item"></squid>
</div>
<h1>ffdf3</h1>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.21/dist/vue.min.js"></script>
<script>
    Vue.component("squid", {
        props:['object'],
        template: "<li>{{object}}</li>"
    });
    var vm = new Vue({
        el: "#app",
        data: {
            message: "hello,vue3!"
        },
        methods: {
            //方法必须定义在vue的method中
            sayHi: function () {
                alert(this.message)
            }
        }
    });
    var vm2 = new Vue({
        el: "#app2",
        data: {
            items:['a','b','c']
        },
        methods: {
            //方法必须定义在vue的method中
            sayHi: function () {
                alert(this.message)
            }
        }
    });
</script>
</body>
</html>